package com.example.javabasic.thread.classtwo.activeobject.demo1;
//active Object

/**
 * 接受异步消息的主动对象    设计模式
 */
public class TestDisplayString extends Thread{
    public static void main(String[] args) {

    }
    private final ActiveObjects activeObjects;

    public TestDisplayString(ActiveObjects activeObjects, String name) {
        super(name);
        this.activeObjects = activeObjects;
    }


    @Override
    public void run() {

        for (int i = 0;i<1 ; i++) {
            String text = Thread.currentThread().getName()+"=>"+i;
            activeObjects.displayString(text);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }



}
